package com.hcy.driver.service.impl;

import com.hcy.driver.dto.request.BaseInfoRequestDTO;
import com.hcy.driver.dto.response.DriverCarInfoResponseDTO;
import com.hcy.ordermodel.dto.response.HomeInfoResponseDTO;
import com.hcy.driver.entity.CarInfo;
import com.hcy.driver.mapper.CarInfoMapper;
import com.hcy.driver.service.ICarInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hcy.ordermodel.dto.request.HomeInfoRequestDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hcy
 * @since 2021-12-29
 */
@Service
public class CarInfoServiceImpl extends ServiceImpl<CarInfoMapper, CarInfo> implements ICarInfoService {

    @Autowired
    CarInfoMapper carInfoMapper;

    @Override
    public HomeInfoResponseDTO getCarInfo(HomeInfoRequestDTO requestDTO) {
        return carInfoMapper.getCarInfoByDriverId(requestDTO.getDriverId());
    }

    @Override
    public boolean updateCarStatus(BaseInfoRequestDTO baseInfoRequestDTO) {
        return carInfoMapper.updateCarStatus(baseInfoRequestDTO);
    }

    @Override
    public DriverCarInfoResponseDTO getDriverCarInfo(Integer driverId) {
        return carInfoMapper.getDriverCarInfo(driverId);
    }

    @Override
    public DriverCarInfoResponseDTO carDriverInfo(Integer carId) {
        return carInfoMapper.carDriverInfo(carId);
    }

    @Override
    public List<DriverCarInfoResponseDTO> carDriverInfoList(List<Integer> carIds) {
        return carInfoMapper.carDriverInfoList(carIds);
    }
}
